<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="renderer" content="webkit|ie-comp|ie-stand">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link href="__STATIC__/admin/assets/css/bootstrap.min.css" rel="stylesheet" />
  <link rel="stylesheet" href="__STATIC__/admin/css/style.css"/>
  <link href="__STATIC__/admin/assets/css/codemirror.css" rel="stylesheet">
  <link rel="stylesheet" href="__STATIC__/admin/assets/css/ace.min.css" />
  <link rel="stylesheet" href="__STATIC__/admin/font/css/font-awesome.min.css" />
  <!--[if lte IE 8]>
  <link rel="stylesheet" href="__STATIC__/admin/assets/css/ace-ie.min.css" />
  <![endif]-->
  <script src="__STATIC__/admin/js/jquery-1.9.1.min.js"></script>
  <script src="__STATIC__/admin/assets/js/bootstrap.min.js"></script>
  <script src="__STATIC__/admin/assets/js/typeahead-bs2.min.js"></script>
  <script src="__STATIC__/admin/assets/js/jquery.dataTables.min.js"></script>
  <script src="__STATIC__/admin/assets/js/jquery.dataTables.bootstrap.js"></script>
  <script src="__STATIC__/admin/assets/layer/layer.js" type="text/javascript" ></script>
  <script src="__STATIC__/admin/assets/laydate/laydate.js" type="text/javascript"></script>
  <title>新闻管理</title>
</head>

<body>
<div class="margin clearfix">
  <div class="Guestbook_style">
    <div class="search_style">
      <div class="title_names">搜索查询</div>
      <ul class="search_content clearfix">
        <li><label class="l_f">标题</label><input name="title" type="text" class="text_add" placeholder="输入标题信息" style=" width:250px"></li>

        <li style="width:90px;"><button type="button" class="btn_search"><i class="icon-search"></i>查询</button></li>
      </ul>
    </div>
    <div class="border clearfix">
       <span class="l_f">
        <a href="javascript:ovid()" class="btn btn-danger"><i class="fa fa-trash"></i>&nbsp;批量删除</a>
        <a href="javascript:ovid()" class="btn btn-sm btn-primary"><i class="fa fa-check"></i>&nbsp;已浏览</a>
        <a href="javascript:ovid()" class="btn btn-yellow"><i class="fa fa-times"></i>&nbsp;未浏览</a>
       </span>
      <span class="r_f">共：<b>{$list->total()}</b>条</span>
    </div>
    <!--留言列表-->
    <div class="Guestbook_list">
      <table class="table table-striped table-bordered table-hover" id="sample-table">
        <thead>
        <tr>
<!--          <th width="25"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th>-->
          <th width="80">ID</th>
          <th width="150px">分类</th>
          <th width="">标题</th>
          <th width="200px">缩略图</th>
          <th width="70">状态</th>
          <th width="250">操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $v}
        <tr>
<!--          <td><label><input type="checkbox" class="ace"><span class="lbl"></span></label></td>-->
          <td>{$v.id}</td>
          <td><u style="cursor:pointer"  class="text-primary" >{$v.catid|getNewName}</u></td>
          <td class="text-l">
              <a href="javascript:;" onclick="Guestbook_iew('<?php echo $v["id"] ;?>')">{$v.title}</a>
          <td><img src="{$v.headimg}" width="100px"></td>
          {if($v.status eq 1)}
          <td class="td-status"><span class="label label-success radius">已显示</span></td>
          {else /}
          <td class="td-status"><span class="label label-defaunt radius">已隐藏</span></td>
          {/if}
          <td class="td-manage">
              {if($v.status eq 1)}
              <a  href="{:url('stop',['id'=>$v.id])}" title="隐藏"  class="btn btn-xs"><i class="fa  fa-eye-slash  bigger-120"></i></a>

              {else /}
              <a  href="{:url('stop',['id'=>$v.id])}" title="显示"  class="btn btn-xs btn-success"><i class="fa fa-eye bigger-120"></i></a>

              {/if}

              <a  href="javascript:;"  onclick="member_del(this,'1')" title="修改" class="btn btn-xs btn-info" ><i class="fa fa-edit  bigger-120"></i></a>
              <a  href="javascript:;"  onclick="member_del(this,'1')" title="删除" class="btn btn-xs btn-warning" ><i class="fa fa-trash  bigger-120"></i></a>


          </td>
        </tr>
        <div id="Guestbook<?php echo $v['id']; ?>" style="display:none">
            <div class="content_style">
                <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">新闻标题 </label>
                    <div class="col-sm-9">{$v.title}</div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 新闻描述 </label>
                    <div class="col-sm-9">{$v.description}</div>
                </div>
                <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">新闻阅读量 </label>
                    <div class="col-sm-9">{$v.read_count}</div>
                </div>
            </div>
        </div>
        {/foreach}
        </tbody>
      </table>
    </div>
  </div>
</div>
<!--留言详细-->

</body>
</html>
<script type="text/javascript">
  /*用户-查看*/
  function member_show(title,url,id,w,h){
    layer_show(title,url+'#?='+id,w,h);
  }
  /*留言-删除*/
  function member_del(obj,id){
    layer.confirm('确认要删除吗？',function(index){
      $(obj).parents("tr").remove();
      layer.msg('已删除!',{icon:1,time:1000});
    });
  }

  /*checkbox激发事件*/
  $('#checkbox').on('click',function(){
    if($('input[name="checkbox"]').prop("checked")){
      $('.Reply_style').css('display','block');
    }
    else{

      $('.Reply_style').css('display','none');
    }
  })
  /*留言查看*/
  function Guestbook_iew(id){
    var index = layer.open({
      type: 1,
      title: '新闻信息',
      maxmin: true,
      shadeClose:false,
      area : ['600px' , ''],
      content:$('#Guestbook'+id),
      btn:['确定','取消'],

    })
  };
  /*字数限制*/
  function checkLength(which) {
    var maxChars = 200; //
    if(which.value.length > maxChars){
      layer.open({
        icon:2,
        title:'提示框',
        content:'您输入的字数超过限制!',
      });
      // 超过限制的字数了就将 文本框中的内容按规定的字数 截取
      which.value = which.value.substring(0,maxChars);
      return false;
    }else{
      var curr = maxChars - which.value.length; //250 减去 当前输入的
      document.getElementById("sy").innerHTML = curr.toString();
      return true;
    }
  };
</script>
<script type="text/javascript">
  jQuery(function($) {
    var oTable1 = $('#sample-table').dataTable( {
      "aaSorting": [[ 1, "desc" ]],//默认第几个排序
      "bStateSave": true,//状态保存
      "aoColumnDefs": [
        //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
        {"orderable":false,"aTargets":[0,2,3,5,6]}// 制定列不参与排序
      ] } );
    $('table th input:checkbox').on('click' , function(){
      var that = this;
      $(this).closest('table').find('tr > td:first-child input:checkbox')
              .each(function(){
                this.checked = that.checked;
                $(this).closest('tr').toggleClass('selected');
              });

    });
    $('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
    function tooltip_placement(context, source) {
      var $source = $(source);
      var $parent = $source.closest('table')
      var off1 = $parent.offset();
      var w1 = $parent.width();

      var off2 = $source.offset();
      var w2 = $source.width();

      if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
      return 'left';
    }
  })
</script>
